<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head th:include="include/admin/adminHeader::html('户主信息管理')" ></head>
<body>
<div th:replace="include/admin/adminNavigator::html" ></div>

    <div class="page-content d-flex align-items-stretch" >
        <nav class="side-navbar">
            <!-- 头像名字部分-->
            <div class="sidebar-header d-flex align-items-center">
                <div class="avatar"><img src="img/admin/admin.jpg" alt="..." class="img-fluid rounded-circle"></div>
                <div class="title">
                    <h1 class="h4">USC</h1>
                    <p>Welcome</p>
                </div>
            </div>
            <!-- 左边菜单-->
            <span class="heading">管理</span>
            <ul class="list-unstyled">
                <li ><a href="admin_householder">户主管理 </a></li>
                <li ><a href="admin_user">用户管理</a></li>
                <li class="active"><a href="admin_statistics">数据统计</a></li>
                <li><a href="admin_check">待审核信息</a></li>
            </ul>
        </nav>

        <!-- 右部部分 -->
        <div class="content-inner" >
            <div style="margin-top: 200px;">
                <span style="width:425px">
                    <canvas id="myChart1" ></canvas>
                </span>
                <span   style="width:425px">
                    <canvas id="myChart" ></canvas>
                </span>
                <span style="width:425px">
                    <canvas id="myChart2" ></canvas>
                </span>
            </div>


            <script>
                if(sessionStorage.jwt ==null||sessionStorage.jwt<3){
                    swal("您没有权限访问该界面","","error")
                    self.location="home"
                }
                var url = "staNum"
                axios.get(url).then(function (response) {

                    var ctx = document.getElementById('myChart1').getContext('2d');
                    var myChart = new Chart(ctx, {
                        type: 'doughnut',
                        data: {
                            labels: ['首页总访问量', '聊天室总访问量','房源页总访问量'],
                            datasets: [{
                                label: '示例',
                                data: [response.data.num1, response.data.num2,response.data.num11],
                                borderColor:'lightGray',
                                backgroundColor:['pink','skyblue','LightYellow','LawnGreen','MediumPurple','orange'],
                                borderWidth: 1
                            }]
                        }
                    });

                    var ctx = document.getElementById('myChart2').getContext('2d');
                    var myChart = new Chart(ctx, {
                        type: 'doughnut',
                        data: {
                            labels: ['聊天室总信息数', '一级评论数', '二级评论数'],
                            datasets: [{
                                label: '示例',
                                data: [response.data.num7, response.data.num8, response.data.num9],
                                borderColor:'lightGray',
                                backgroundColor:['pink','skyblue','LightYellow','LawnGreen','MediumPurple','orange'],
                                borderWidth: 1
                            }]
                        }
                    });


                    var ctx = document.getElementById('myChart').getContext('2d');
                    var myChart = new Chart(ctx, {
                        type: 'bar',
                        data: {
                            labels: ['总用户数','聊天室人数', '户主人数', '总房源数', '总房间数'],
                            datasets: [{
                                label: 'Sum',
                                data: [response.data.num3,response.data.num10, response.data.num4, response.data.num5, response.data.num6],
                                borderColor:'blue',
                                backgroundColor:'skyBlue',
                                borderWidth: 1,
                            }]
                        },
                        options: {
                            scales: {
                                yAxes: [{
                                    ticks: {
                                        beginAtZero:true
                                    },
                                }]
                            }
                        }
                    });
                })
            </script>
            <!--页脚部分-->
            <div th:replace="include/admin/adminFooter::html" ></div>
        </div>
    </div>
</body>
</html>
